//==================================================================
//  Copyright (C) 2006  Davide Pasca
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, write to the Free Software
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
//==================================================================
/// @file	shcube.h
///
/// Spherical Harmonics generation from cubemaps
///
//==================================================================

#ifndef SHCUBE_H
#define SHCUBE_H

#include "psys.h"
#include "image_base.h"
#include "pvector.h"

//===============================================================================
enum {
	SHCUBE_FACE_NX=0,		// LEFT
	SHCUBE_FACE_PX,			// RIGHT
	SHCUBE_FACE_NY,			// BOTTOM
	SHCUBE_FACE_PY,			// TOP
	SHCUBE_FACE_NZ,			// BACK
	SHCUBE_FACE_PZ			// FRONT
};

//===============================================================================
class SHCube
{
	int		_dim;
	float	*_Ylm_valuesp[6];

public:
	SHCube( int dim );
	~SHCube();

	void		Integrate( float out_rgb_coe[3][9], PUtils::ImageBase *face_maps_listp[6] );
	static int	FireSpecularRay_s( const PMath::Vector3 &ray, int *out_uip, int *out_vip );
};

#endif
